<include file="public@header" />
</head>
<body>
<div class="wrap">
	<include file="dictionary/nav" />
	<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('dictionary/save')}">
		<div class="form-group">
			<label for="input-dict_type" class="col-sm-2 control-label"><span class="form-required">*</span>字典类型</label>
			<div class="col-md-6 col-sm-10">
				<select id="input-dict_type" class="form-control" name="dict_type">
					<foreach name="dict_types" item="item" key="key">
						<option value="{$key}">{$item}</option>
					</foreach>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label for="input-key" class="col-sm-2 control-label"><span class="form-required">*</span>key</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="input-key" name="key" value="">
			</div>
		</div>
		<div class="form-group">
			<label for="input-value" class="col-sm-2 control-label"><span class="form-required">*</span>value</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="input-value" name="value" value="">
			</div>
		</div>
		<div class="form-group">
			<label for="input-remark" class="col-sm-2 control-label">备注</label>
			<div class="col-md-6 col-sm-10">
				<input type="text" class="form-control" id="input-remark" name="remark" value="">
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-offset-2 col-sm-10">
				<input type="hidden" name="id" id="input-id" value="" />
				<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('SAVE')}</button>
				<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
			</div>
		</div>
	</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
	// 表单自动填充
    <notempty name="dictionary">
    var dictionary = {$dictionary|json_encode};

    for(var key in dictionary) {
        if(key === 'dict_type') {
            $('#input-dict_type').val([dictionary[key]]);
        } else {
            $('#input-'+key).val(dictionary[key]);
        }
    }
    </notempty>
</script>
</body>
</html>